# INSERT_YOUR_CODE

dir="/mnt/nas/datasets/diction"

# 分类与后缀
categories=(slipdress dress suitset suit trousers jacket widepants hoodie)
suffixes=("_img_clo" "_img_clo_diff" "_img_clo_diff_furry" "_img_clo_diff_pattern" "_img_front_back")
# 日期字符串
dates=(
    "0915" "0916" "0917" "0918" "0919" \
    "0922" "0923" "0924" "0925" "0926" \
    "0928" "0929" "0930" \
    "1009" "1010" "1011" \
    "1013" "1014" "1016" \
    "1020" "1021" "1022" "1023" "1024" \
    "1027" "1028" "1029" "1030" "1031" \
    "1103" "1104" "1105" "1106" "1107")

# 用于统计
declare -A stat_counts

for category in "${categories[@]}"; do
  for date in "${dates[@]}"; do
    for suffix in "${suffixes[@]}"; do
      path="$dir/${category}${date}${suffix}"
      if [ -d "$path" ]; then
        # 执行 restore.sh
        bash restore.sh "$path"
        # 检查 names.txt 存在
        names_txt="$path/names.txt"
        if [ -f "$names_txt" ]; then
          count=$(grep -c "\.jpg" "$names_txt")
        else
          count=0
        fi
        # 统计
        key="${category}${date}${suffix}"
        stat_counts["$key"]=$count
        echo "$key: $count"
      fi
    done
  done
done

# 汇总输出所有存在的key
echo "------summary------"
for key in "${!stat_counts[@]}"; do
  echo "$key: ${stat_counts[$key]}"
done

